#!/bin/bash

######
lsb_function="/lib/lsb/init-functions"
if test -f $lsb_function; then
	. $lsb_function
else
	init_functions="etc/init.d/functions"
	if test -f $init_functions;then
		. $init_function
	fi
	log_success_msg() {
		echo "success!$@"
	}
	log_failure_msg(){
		echo "ERROR!$@"
	}
#####

## 定义错误提示函数
function usages(){
	echo "usage:$0 url"
	exit 1
}

# 定义检查的函数
check(){
	wget --spider -q -o /dev/null --tries=1 -T 5 $1
	if [ $? -ne 0 ];then
		echo "$1 is running..."
	else 
		echo "$1 is down..."
	fi
}

# 入口函数
main() {
	[[ $# -ne 1 ]] && {
		uasges
	}
	check
}

main $*
